package com.ruoyi.ncpsy.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ncpsy.mapper.NcpsyCropEventMapper;
import com.ruoyi.ncpsy.domain.NcpsyCropEvent;
import com.ruoyi.ncpsy.service.INcpsyCropEventService;

/**
 * 作物事件记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-29
 */
@Service
public class NcpsyCropEventServiceImpl implements INcpsyCropEventService 
{
    @Autowired
    private NcpsyCropEventMapper ncpsyCropEventMapper;

    public final String configFile = "ruoyi-admin/src/main/resources/config-example.toml";

    /**
     * 查询作物事件记录
     * 
     * @param cropEventId 作物事件记录主键
     * @return 作物事件记录
     */
    @Override
    public NcpsyCropEvent selectNcpsyCropEventByCropEventId(Long cropEventId)
    {
        return ncpsyCropEventMapper.selectNcpsyCropEventByCropEventId(cropEventId);
    }

    /**
     * 查询作物事件记录列表
     * 
     * @param ncpsyCropEvent 作物事件记录
     * @return 作物事件记录
     */
    @Override
    public List<NcpsyCropEvent> selectNcpsyCropEventList(NcpsyCropEvent ncpsyCropEvent)
    {
        return ncpsyCropEventMapper.selectNcpsyCropEventList(ncpsyCropEvent);
    }

    /**
     * 新增作物事件记录
     * 
     * @param ncpsyCropEvent 作物事件记录
     * @return 结果
     */
    @Override
    public int insertNcpsyCropEvent(NcpsyCropEvent ncpsyCropEvent)
    {
        ncpsyCropEvent.setCreateTime(DateUtils.getNowDate());

        return ncpsyCropEventMapper.insertNcpsyCropEvent(ncpsyCropEvent);
    }

    /**
     * 修改作物事件记录
     * 
     * @param ncpsyCropEvent 作物事件记录
     * @return 结果
     */
    @Override
    public int updateNcpsyCropEvent(NcpsyCropEvent ncpsyCropEvent)
    {
        ncpsyCropEvent.setUpdateTime(DateUtils.getNowDate());
        return ncpsyCropEventMapper.updateNcpsyCropEvent(ncpsyCropEvent);
    }

    /**
     * 批量删除作物事件记录
     * 
     * @param cropEventIds 需要删除的作物事件记录主键
     * @return 结果
     */
    @Override
    public int deleteNcpsyCropEventByCropEventIds(Long[] cropEventIds)
    {
        return ncpsyCropEventMapper.deleteNcpsyCropEventByCropEventIds(cropEventIds);
    }

    /**
     * 删除作物事件记录信息
     * 
     * @param cropEventId 作物事件记录主键
     * @return 结果
     */
    @Override
    public int deleteNcpsyCropEventByCropEventId(Long cropEventId)
    {
        return ncpsyCropEventMapper.deleteNcpsyCropEventByCropEventId(cropEventId);
    }
}
